home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / CAD / LISP04.ARJ / BLOCKS.LSP < prev    next >
Text File  |  1990-02-09  |  1KB  |  21 lines

  1. ;Autocad block documentation routine by AL SCHEIB
  2. ;Compuserve [76100,1630]
  3. ;This routine writes the names of all blocks defined within a .dwg
  4. ;to a text file named using the "dwgname" (variable).txt
  5. (defun C:BLOCKS (/ count file fyle blkname blist)
  6.   (setq COUNT 0)
  7.   ;use the following line of code instead of the one following IT
  8.   ;to write to a filename other than "dwgname".txt
  9.   ;(setq file (open (setq fyle (getstring "\nWrite to filename: ")) "w")) 
  10.   (setq FILE (open (setq FYLE (strcat (getvar "dwgname") ".txt") "w"))
  11.   (setq BLIST (tblnext "BLOCK" t))   ;GET FIRST BLOCK IN DATABASE
  12.   (WHILE (BOUNDP 'BLIST)  ;WHILE not END OF BLOCK TABLE
  13.     (SETQ BLKNAME (cdr (assoc 2 BLIST)))  ;GET BLOCK NAME
  14.          (write-line BLKNAME);print it to the screen   
  15.          (setq COUNT (+ COUNT 1))
  16.          (if (/= "*" (substr blkname 1 1))(write-line blkname file)) ;if it's not a hatch
  17.   (setq BLIST (tblnext "BLOCK" )))   ;GET NEXT BLOCK IN DATABASE; END LOOP
  18.   (princ COUNT)(princ " block names written to filename: '")(princ FYLE)(prin1 "'")
  19.   (close file)    
  20. )   ;end blocks
  21.